<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>项目管理</title>
    <meta name="description" content="">
    <meta name="author" content="templatemo">
    <link href="../css/font-awesome.min.css" rel="stylesheet">
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/templatemo-style.css" rel="stylesheet">
    <link href="../css/admin.css" rel="stylesheet">
    <script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="../js/admin.js"></script>
</head>

<body>
    <script>
        function delprouser(id) {
            if (window.confirm('确定删除吗？')) {
                $.ajax({
                    type: "GET",
                    url: 'dodelPuser.php',
                    async: false,
                    dataType: "json",
                    data: {
                        'uid': id
                    },
                    success: function(msg) {
                        if (msg.status == 1) {
                            alert(msg.mes);
                            window.location.reload();
                        }
                        if (msg.status == -1) {
                            alert(msg.mes);
                            window.location.reload();
                        }
                    },
                });
            }
        }
    </script>
    <?php
    require_once "../congfig/config.php";
    require_once "../lib/common.php";
    session_start();
    checkAdmin();
    $pid = $_GET['pid'];
    $pagesize = 2;
    $sql = "select * from puser  where pid='$pid' ";
    $query = $GLOBALS['conn']->query($sql);
    $num = $query->num_rows;
    $page = empty($_GET['page']) ? 1 : $_GET['page'];
    $prepage = $page - 1;
    $nextpage = $page + 1;
    $tatolpage = ceil($num / $pagesize);
    $startpage = ($page - 1) * $pagesize;
    $sql = "select * from puser where pid='$pid' LIMIT $startpage,$pagesize ";
    $query = $GLOBALS['conn']->query($sql);

    ?>
    <!-- Left column -->
    <div class="templatemo-flex-row">
        <div class="templatemo-sidebar">
            <header class="templatemo-site-header">
                <div class="square"></div>
                <h1>后台管理系统</h1>
            </header>
            <div class="profile-photo-container">
                <img src="../images/profile-photo.jpg" alt="Profile Photo" class="img-responsive">
            </div>
            <!-- Search box -->

            <div class="mobile-menu-icon">
                <i class="fa fa-bars"></i>
            </div>
            <nav class="templatemo-left-nav">
                <ul>
                    <li id="xmgl"><a href="project-list.php"><i class="fa fa-bars fa-fw"></i>项目管理</a>
                        <ul>
                            <li><a href="addProject.php"><i class="fa fa-bars fa-fw"></i>添加项目</a></li>
                        </ul>
                        <ul>
                            <li><a href="applyproject.php"><i class="fa fa-bars fa-fw"></i>申请立项</a></li>
                        </ul>
                        <ul>
                            <li><a href="projectsucc.php"><i class="fa fa-bars fa-fw"></i>立项成功</a></li>
                        </ul>
                        <ul>
                            <li><a href="projectfail.php"><i class="fa fa-bars fa-fw"></i>立项失败</a></li>
                        </ul>
                        <ul>
                            <li><a href="applyprojectover.php"><i class="fa fa-bars fa-fw"></i>申请结项</a></li>
                        </ul>
                        <ul>
                            <li><a href="projectok.php"><i class="fa fa-bars fa-fw"></i>结项成功</a></li>
                        </ul>
                        <ul>
                            <li><a href="projectnok.php"><i class="fa fa-bars fa-fw"></i>结项失败</a></li>
                        </ul>
                        <ul>
                            <li><a href="goodpro.php"><i class="fa fa-bars fa-fw"></i>逾期项目</a></li>
                        </ul>
                    </li>
                    <li id="yhgl"><a href="user-list.php"><i class="fa fa-user fa-fw"></i>用户管理</a>
                        <ul>
                            <li><a href="addUser.php"><i class="fa fa-user fa-fw"></i>添加用户</a></li>
                        </ul>
                    </li>
                    <li><a href="pad-check.php"><i class="fa fa-cog fa-fw"></i>修改密码</a></li>
                    <li><a href="../loginout.php" id="zx"><i class="fa fa-map-marker fa-fw"></i>注销</a></li>
                </ul>
            </nav>
        </div>
        <!-- Main content -->
        <div class="templatemo-content col-1 light-gray-bg" style="height:1000px;">
            <div class="container" style="margin-top:100px;">
                <a style="font-size:18px; color:rgb(19,137,95);" href="project-list.php"><i class="fa fa-arrow-circle-left fa-fw"></i>
                    返 回</a>
                <div id="alterProjectUser" style="margin-top: 30px;">
                    <table class="table table-hover  table-striped">
                        <thead>
                            <tr>
                                <th class="col-md-2">编号</th>
                                <th class="col-md-7">项目成员</th>
                                <th class="col-md-3">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            while ($result = $query->fetch_array()) {
                              ?>
                            <tr>
                                <td id="uid" class="col-md-2">
                                    <?php echo $result["uid"]; ?>
                                </td>
                                <?php 
                                $uid = $result['uid'];
                                $sql = "select * from userinfor where uid = '$uid' ";
                                $query1 = $GLOBALS['conn']->query($sql);
                                $result = $query1->fetch_array();
                                ?>
                                <td class="col-md-7">
                                    <?php echo $result["realname"]; ?>
                                </td>
                                <td class="col-md-3"><button class="btn btn-xs btn-danger" onclick="delprouser(<?php echo $uid ?>)">删除</button></td>
                            </tr>
                            <?php

                          }
                          ?>
                        </tbody>
                    </table>
                    <?php
                    if ($prepage <= 0) {
                      $prepage = 1;
                    }
                    if ($nextpage > $tatolpage) {
                      $nextpage = $page;
                    }
                    ?>
                    <?php
                    if ($prepage < 0) {
                      $prepage = 0;
                    }
                    if ($nextpage > $tatolpage) {
                      $nextpage = $page;
                    }
                    ?>
                    <footer class="footer pull-right">
                        <ul class="pagination">
                            <li><a href="alterProjectUser.php?page=0&pid=<?php echo $pid ?>"><i class=" fa fa-fast-backward" style="color:rgb(19,137,95);font-size:20px;"></i></a></li>
                            <li><a href="alterProjectUser.php?page=<?php echo $prepage ?>&pid=<?php echo $pid ?>"><i class="fa fa-backward " style="color:rgb(19,137,95);font-size:20px;  "></i></a></li>
                            <li class="gray">
                                <span style="font-size:15px; height: 45px;padding-top:13px;">第
                                    <?php echo $page ?> 页</span>
                            </li>
                            <li><a href="alterProjectUser.php?page=<?php echo $nextpage ?>&pid=<?php echo $pid ?>"><i class="  fa fa-forward" style="color:rgb(19,137,95);font-size:20px;"></i></a></li>
                            <li><a href="alterProjectUser.php?page=<?php echo $tatolpage ?>&pid=<?php echo $pid ?>"><i class=" fa fa-fast-forward" style="color:rgb(19,137,95);font-size:20px; "></i></a></li>
                        </ul>
                    </footer>
                </div>
            </div>
        </div>


    </div>
</body>

</html> 